package com.isoftstone.merchant.service.mdept;

import com.isoftstone.common.Page;
import com.isoftstone.merchant.entity.mdept.MDept;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created by as on 2017/11/28.
 */
public interface IMdeptService {

    List<MDept> getDeptlistPage(Page page) throws Exception;

    List<MDept> getDeptAll(@Param("corpId")String corpId)throws Exception;

    //递归向下查询
    List<MDept> getDownDeptAll(String corpId) throws Exception;

    //递归向上查询
    List<MDept> getUpDeptAll(String deptId) throws Exception;

    MDept getDeptById(String DId) throws Exception;

    MDept getRootDept(String mid) throws Exception;

    void saveDept(MDept dept) throws Exception;

    String selectdept(String deptName, String superDeptId,String corpId) throws Exception;

    void deleteDept(String deptId) throws Exception;

    MDept getparaentDept(String deptId) throws Exception;

    void updateDept(MDept dept) throws Exception;

    List<MDept> tongjiDepts(String deptId) throws Exception;

    MDept getMDeptBymId(String mid) throws Exception;

    List<MDept> getDeptAllTree() throws Exception;

    //插入顶级机构 机构名为商户名
    void insertFirstdept(MDept dept) throws Exception;

    //缴费用户使用
    MDept getDeptbyIdFeeUser(String deptId, String superDeptId) throws Exception;

    List<MDept> getAllDeptByCorpId(String corpId) throws Exception;

    //批量导入使用
    List<MDept> getDeptByNameAndLevel(Map<String, Object> map) throws Exception;


    String getUserDeptById(String deptId) throws Exception;

    //根据商户编号和上级部门id查找部门
    List<MDept> getParentDeptByIdandCorpId(String deptId, String corpId) throws Exception;

    //根据superId查询deptid
    MDept getDeptBySuperId(@Param("superId")String superId)throws Exception;

    List<MDept> queryDeptBySuperId(@Param("superId")String superId)throws Exception;

    /**
     * 商户缴费单位机构递归向下查询
     * @param deptId
     * @return
     *//*
    public List<MDept> getDowndetptree(String deptId);

    public List<MDept> getDownALLtree(String deptId) throws Exception;

    *//**
     * 手机端缴费用户机构向上查询
     * @param superId
     * @return
     * @throws Exception
     */
    public List<MDept> getUpdetptree(String superId) throws Exception;

    public List<MDept> getUpAlltree(String superId) throws Exception;

    String getDeptNameBydeptId(@Param("deptId") String deptId)throws Exception;

    Integer getleavlBydeptIdandCorpId(String deptId, String corpId)throws Exception;

    String getdeptIdBydeptId(String deptId)throws Exception;
    //查询所有父级id为superDeptId 的部门
    List<MDept> getDeptBySupId(String superDeptId)throws Exception;

    List<MDept> getsonDept(String superDeptId)throws Exception;

    //导入机构exls
    void saveExcelData(List<MDept> resultList)throws Exception;
}
